package com.minarto.core {
	import flash.display.*;
	import flash.external.ExternalInterface;
	
	/**
	 * @author minarto
	 */
	public class Bridge {
		static private var	_SET_CONFIG:String = "setConfig", 
							
							_LOGIN:String = "login",
							_LOGOUT:String = "logout",
							
							_GET_SOCIAL_LIST:String = "getSocialList",
							_GET_SOCIAL_INFO:String = "getSocialInfo",
							_DEL_SOCIAL_LIST:String = "delSocialList",
							
							_GC:String = "gc",
							
							_PLAY_SOUND:String = "playSound",
							_PAUSE_SOUND:String = "pauseSound",
							_STOP_SOUND:String = "stopSound",
							
							_TRANSLATION:String = "translation",
							
							_UI_REMOVE:String = "uiRemove",
							_UI_OPEN:String = "uiOpen",
							_UI_CLOSE:String = "uiClose",
							
							_ERROR:String = "error";
							
		
		
		static public function GET_CONFIG($uiID:String = null):String {
			return	ExternalInterface.call("getConfig", $uiID);
		}
		static public function SET_CONFIG($uiID:String = null):Boolean {
			return	ExternalInterface.call(_SET_CONFIG, $uiID);
		}
		
		
		static public function ERROR($target:*, $msg:String):Boolean {
			return	ExternalInterface.call(_ERROR, $target, $msg);
		}
		
		
		static public function LOGIN($id:String, $pw:String, $service:String = null):Boolean {
			return	ExternalInterface.call(_LOGIN, $id, $pw, $service);
		}
		static public function LOGOUT($service:String = null):Boolean {
			return	ExternalInterface.call(_LOGOUT, $service);
		}
		
		
		static public function GET_SOCIAL_LIST($length:uint, $service:String = null):Array {
			return	ExternalInterface.call(_GET_SOCIAL_LIST, $length, $service);
		}
		static public function GET_SOCIAL_INFO($id:String, $service:String = null):String {
			return	ExternalInterface.call(_GET_SOCIAL_INFO, $id, $service);
		}
		static public function DEL_SOCIAL_LIST($id:String, $service:String = null):Boolean {
			return	ExternalInterface.call(_DEL_SOCIAL_LIST, $id, $service);
		}
		
		
		static public function GC():Boolean {
			return	ExternalInterface.call(_GC);
		}
		
		
		static public function PLAY_SOUND($soundID:String):String {
			return	ExternalInterface.call(_PLAY_SOUND, $soundID);
		}
		static public function PAUSE_SOUND($soundChannelID:String):Boolean {
			return	ExternalInterface.call(_PAUSE_SOUND, $soundChannelID);
		}
		static public function STOP_SOUND($soundChannelID:String):Boolean {
			return	ExternalInterface.call(_STOP_SOUND, $soundChannelID);
		}
		
		
		static public function TRANSLATION($str:String):String {
			return	ExternalInterface.call(_TRANSLATION, $str);
		}
		
		
		static public function UI_REMOVE($uiID:String, $ui:DisplayObject):String {
			return	ExternalInterface.call(_UI_REMOVE, $uiID, $ui);
		}
		static public function UI_OPEN($uiID:String, $ui:DisplayObject):String {
			return	ExternalInterface.call(_UI_OPEN, $uiID, $ui);
		}
		static public function UI_CLOSE($uiID:String, $ui:DisplayObject):String {
			return	ExternalInterface.call(_UI_CLOSE, $uiID, $ui);
		}
		
		
		
		public function Bridge() {
			throw new Error("don't create instance");
		}
	}
}